/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package abstractBasicModel.impl;

import abstractBasicModel.AbstractBasicModel;
import abstractBasicModel.AbstractBasicModelPackage;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Abstract Basic Model</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link abstractBasicModel.impl.AbstractBasicModelImpl#getScheduler <em>Scheduler</em>}</li>
 *   <li>{@link abstractBasicModel.impl.AbstractBasicModelImpl#getId <em>Id</em>}</li>
 *   <li>{@link abstractBasicModel.impl.AbstractBasicModelImpl#getWcet <em>Wcet</em>}</li>
 *   <li>{@link abstractBasicModel.impl.AbstractBasicModelImpl#getPeriod <em>Period</em>}</li>
 *   <li>{@link abstractBasicModel.impl.AbstractBasicModelImpl#getDeadline <em>Deadline</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public abstract class AbstractBasicModelImpl extends EObjectImpl implements AbstractBasicModel {
	/**
	 * The default value of the '{@link #getScheduler() <em>Scheduler</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getScheduler()
	 * @generated
	 * @ordered
	 */
	protected static final int SCHEDULER_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getScheduler() <em>Scheduler</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getScheduler()
	 * @generated
	 * @ordered
	 */
	protected int scheduler = SCHEDULER_EDEFAULT;

	/**
	 * The cached value of the '{@link #getId() <em>Id</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected EList<String> id;

	/**
	 * The cached value of the '{@link #getWcet() <em>Wcet</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getWcet()
	 * @generated
	 * @ordered
	 */
	protected EList<Integer> wcet;

	/**
	 * The cached value of the '{@link #getPeriod() <em>Period</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPeriod()
	 * @generated
	 * @ordered
	 */
	protected EList<Integer> period;

	/**
	 * The cached value of the '{@link #getDeadline() <em>Deadline</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDeadline()
	 * @generated
	 * @ordered
	 */
	protected EList<Integer> deadline;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AbstractBasicModelImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return AbstractBasicModelPackage.Literals.ABSTRACT_BASIC_MODEL;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getScheduler() {
		return scheduler;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setScheduler(int newScheduler) {
		int oldScheduler = scheduler;
		scheduler = newScheduler;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__SCHEDULER, oldScheduler, scheduler));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getId() {
		if (id == null) {
			id = new EDataTypeUniqueEList<String>(String.class, this, AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__ID);
		}
		return id;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Integer> getWcet() {
		if (wcet == null) {
			wcet = new EDataTypeUniqueEList<Integer>(Integer.class, this, AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__WCET);
		}
		return wcet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Integer> getPeriod() {
		if (period == null) {
			period = new EDataTypeUniqueEList<Integer>(Integer.class, this, AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__PERIOD);
		}
		return period;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Integer> getDeadline() {
		if (deadline == null) {
			deadline = new EDataTypeUniqueEList<Integer>(Integer.class, this, AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__DEADLINE);
		}
		return deadline;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIds(EList<String> l_ids) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setWcets(EList<Integer> l_wcets) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPeriods(EList<Integer> l_periods) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDeadlines(EList<Integer> l_deadlines) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__SCHEDULER:
				return new Integer(getScheduler());
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__ID:
				return getId();
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__WCET:
				return getWcet();
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__PERIOD:
				return getPeriod();
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__DEADLINE:
				return getDeadline();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__SCHEDULER:
				setScheduler(((Integer)newValue).intValue());
				return;
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__ID:
				getId().clear();
				getId().addAll((Collection<? extends String>)newValue);
				return;
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__WCET:
				getWcet().clear();
				getWcet().addAll((Collection<? extends Integer>)newValue);
				return;
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__PERIOD:
				getPeriod().clear();
				getPeriod().addAll((Collection<? extends Integer>)newValue);
				return;
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__DEADLINE:
				getDeadline().clear();
				getDeadline().addAll((Collection<? extends Integer>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__SCHEDULER:
				setScheduler(SCHEDULER_EDEFAULT);
				return;
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__ID:
				getId().clear();
				return;
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__WCET:
				getWcet().clear();
				return;
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__PERIOD:
				getPeriod().clear();
				return;
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__DEADLINE:
				getDeadline().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__SCHEDULER:
				return scheduler != SCHEDULER_EDEFAULT;
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__ID:
				return id != null && !id.isEmpty();
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__WCET:
				return wcet != null && !wcet.isEmpty();
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__PERIOD:
				return period != null && !period.isEmpty();
			case AbstractBasicModelPackage.ABSTRACT_BASIC_MODEL__DEADLINE:
				return deadline != null && !deadline.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (scheduler: ");
		result.append(scheduler);
		result.append(", id: ");
		result.append(id);
		result.append(", wcet: ");
		result.append(wcet);
		result.append(", period: ");
		result.append(period);
		result.append(", deadline: ");
		result.append(deadline);
		result.append(')');
		return result.toString();
	}

} //AbstractBasicModelImpl
